function _form_process(result)
{
	if(result.errno == "-1")
	{
		if (document.getElementById('notification_box'))
		{
			$.scrollTo(0, 800, {queue:true});
			
			$("#notification_box").removeClass("success").addClass("error").fadeIn().find('[name=notification_content]').html(result.err);
			
		}
		else
		{
			alert(result.err);
		}
	}
	else if(result.errno == "1")
	{
		if(result.rsm && result.rsm.url)
		{
			window.location.href = decodeURIComponent(result.rsm.url);
		}
		else
		{
			if (document.getElementById('notification_box'))
			{
				$.scrollTo(0, 800, {queue:true});
				
				$("#notification_box").removeClass("error").addClass("success").fadeIn().find('[name=notification_content]').html(result.err);
				
				setTimeout(function () {
					$('#notification_box').fadeOut();
				}, 3000);
			}
			else
			{
				window.location.reload();
			}
		}
	}
}

function topic_remove(topic_id)
{
	if(!confirm("确定删除话题？"))
	{
		return false;
	}
	
	var url = G_BASE_URL + '/admin/topic/topic_remove_ajax/topic_id-' + topic_id;
	
	$.getJSON(url, function (response)
	{
		if(response)
		{
			if(response.err)
			{
				alert(response.err);
			}
			
			if(response.errno == 1)
			{
				if(response.rsm)
				{
					if(response.rsm.url != undefined)
					{
						window.location.href = response.rsm.url;
					}
					else
					{
						window.location.reload();
					}
				}
				window.location.reload();
			}
		}
		else
		{
			alert("系统错误");
		}
	},'json').error(function (error) { alert('发生错误, 返回的信息: ' + error.responseText); });
}


function topic_lock(topic_id, status)
{
	var url = G_BASE_URL + '/admin/topic/topic_lock/topic_id-' + topic_id + '__status-' + status;
	
	$.getJSON(url, function (response)
	{
		if(response)
		{
			if(response.err)
			{
				alert(response.err);
			}
			
			if(response.errno == 1)
			{
				if(response.rsm)
				{
					if(response.rsm.url != undefined)
					{
						window.location.href = response.rsm.url;
					}
					else
					{
						window.location.reload();
					}
				}
				window.location.reload();
			}
		}
		else
		{
			alert("系统错误");
		}
	},'json').error(function (error) { alert('发生错误, 返回的信息: ' + error.responseText); });
}

function apply_pass(apply_id)
{
	var url = G_BASE_URL + '/admin/user/review_apply_ajax/apply_id-' + apply_id;
	
	$.getJSON(url, function (response){
		if(response)
		{
			if(response.err)
			{
				alert(response.err);
			}
			
			if(response.errno == 1)
			{
				window.location.reload();
			}
		}
		else
		{
			alert("系统错误");
		}
	},'json').error(function (error) { alert('发生错误, 返回的信息: ' + error.responseText); });
}

function apply_ignore(apply_id)
{
	if(!confirm("确定忽略？\n[忽略的记录将不会在本页显示。]"))
	{
		return false;
	}
		
	var url = G_BASE_URL + '/admin/user/ignore_apply_ajax/apply_id-' + apply_id;
	
	$.getJSON(url, function (response){
		if(response)
		{
			if(response.err)
			{
				alert(response.err);
			}
			
			if(response.errno == 1)
			{
				window.location.reload();
			}
		}
		else
		{
			alert("系统错误");
		}
	},'json').error(function (error) { alert('发生错误, 返回的信息: ' + error.responseText); });
}
	
function edit_topic_parent(topic_id, parent_id, target_id)
{
	$.facebox('<iframe src="' + G_BASE_URL + '/admin/topic/topic_select_list_v2_ajax/topic_id-' + topic_id + '__parent_id-' + parent_id + '__target_id-' + target_id + '" frameborder="0" id="edit_topic_parent_frame" height="100%" width="100%" scrolling="auto"></iframe>');
}

function question_remove(question_id)
{
	if(!confirm("确定删除问题与问题关联的回复等内容？"))
	{
		return false;
	}
		
	var url = G_BASE_URL + '/admin/question/question_remove/question_id-' + question_id;
	
	$.getJSON(url, function (response){
		if(response)
		{
			if(response.err)
			{
				alert(response.err);
			}
			
			if(response.errno == 1)
			{
				window.location.reload();
			}
		}
		else
		{
			alert("系统错误");
		}
	},'json').error(function (error) { alert('发生错误, 返回的信息: ' + error.responseText); });
}


function category_remove(category_id)
{
	if(!confirm("确定删除分类及其子分类？"))
	{
		return false;
	}
	
	var url = G_BASE_URL + '/admin/category/category_remove/category_id-' + category_id;
	
	$.getJSON(url, function (response){
		if(response)
		{
			if(response.err)
			{
				alert(response.err);
			}
			
			if(response.errno == 1)
			{
				window.location.reload();
			}
		}
		else
		{
			alert("系统错误");
		}
	},'json').error(function (error) { alert('发生错误, 返回的信息: ' + error.responseText); });
}

function change_send_email(el)
{
	if(el.val() == '2')
	{
		el.parent().parent().find("[groupid=6]").hide();
	}
	else if(el.val() == '1')
	{
		el.parent().parent().find("[groupid=6]").show();
	}
	return false;
}

function test_email_setting(fm, el)
{
	var fm_array = fm.formToArray();
	
	el.val("  正在发送...  ");
	
	$.post(G_BASE_URL + '/admin/setting/test_email_setting/', fm_array, function (result)
	{
		el.val("  发送测试邮件  ");
		
		alert(result.err);
	}, 'json').error(function (error) { el.val("  发送测试邮件  "); alert('发生错误, 返回的信息: ' + error.responseText); });
}

function forbi_user(uid, status)
{
	confirm_str = (status == "1") ? "禁止用户" : "解除禁止";
	
	if(!confirm("确定" + confirm_str + "?"))
	{
		return false;
	}
	
	$.getJSON(G_BASE_URL + '/admin/user/forbidden_status_ajax/user_id-' + uid + '__status-' + status, function (result){
		if(result)
		{
			if(result.err)
			{
				alert(result.err);
			}
			
			if(result.errno == 1)
			{
				window.location.reload();
			}
		}
	});
}